Skip to content

fix: state undefined - #6497

Merged
KevinVandy merged 1 commit into
betafrom
fix/undefined-controlled-state-5909
Aug 2, 2026
Merged

fix: state undefined#6497
KevinVandy merged 1 commit into
betafrom
fix/undefined-controlled-state-5909

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Aug 2, 2026

Copy link
Copy Markdown
Member

🎯 Changes

fixes #5909

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

Summary by CodeRabbit

  • Bug Fixes

    • Improved controlled table state handling when values are explicitly cleared.
    • Table state now correctly falls back to configured defaults or initial values.
    • Restored reactive updates when controlled state keys are removed.
    • Fixed clearing behavior for column and global filters.
  • Tests

    • Added coverage for controlled and uncontrolled state transitions, default fallbacks, and filter clearing.

@nx-cloud

nx-cloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 81585b6

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 7m 57s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 1m 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-02 18:37:38 UTC

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c8a100df-3268-4f30-97b2-9b5e4bd60f11

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe1f85 and 81585b6.

📒 Files selected for processing (3)
  • packages/table-core/src/core/table/constructTable.ts
  • packages/table-core/src/core/table/coreTablesFeature.utils.ts
  • packages/table-core/tests/unit/core/tableAtoms.test.ts

📝 Walkthrough

Walkthrough

Controlled table state slices set to undefined now fall back to slice defaults or initialState. Defined controlled values remain authoritative. Synchronization avoids writing undefined to base atoms, and tests cover controlled and uncontrolled transitions.

Changes

Controlled state fallback

Layer / File(s) Summary
Controlled state resolution
packages/table-core/src/core/table/constructTable.ts
Controlled slices preserve defined values and use the slice initial state when explicitly set to undefined.
Synchronization and regression coverage
packages/table-core/src/core/table/coreTablesFeature.utils.ts, packages/table-core/tests/unit/core/tableAtoms.test.ts
External synchronization maps undefined slices to initial-state values. Tests cover resets, restored uncontrolled writes, and clearing a controlled global filter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • TanStack/table#6458: Overlaps in controlled-state synchronization and atom fallback behavior.

Suggested reviewers: riccardoperra

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the fix for undefined table state, which matches the primary change.
Linked Issues check ✅ Passed The changes address issue [#5909] by preventing undefined controlled slices from entering table state and adding focused regression tests.
Out of Scope Changes check ✅ Passed All implementation and test changes directly support the undefined controlled-state fix described in [#5909].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/undefined-controlled-state-5909

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 2, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/alpine-table@6497

@tanstack/angular-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table@6497

@tanstack/angular-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table-devtools@6497

@tanstack/ember-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/ember-table@6497

@tanstack/lit-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/lit-table@6497

@tanstack/match-sorter-utils

npm i https://pkg.pr.new/TanStack/table/@tanstack/match-sorter-utils@6497

@tanstack/octane-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/octane-table@6497

@tanstack/preact-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table@6497

@tanstack/preact-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table-devtools@6497

@tanstack/react-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table@6497

@tanstack/react-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table-devtools@6497

@tanstack/solid-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table@6497

@tanstack/solid-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table-devtools@6497

@tanstack/svelte-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/svelte-table@6497

@tanstack/table-core

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-core@6497

@tanstack/table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-devtools@6497

@tanstack/vue-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table@6497

@tanstack/vue-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table-devtools@6497

commit: 81585b6

@KevinVandy
KevinVandy merged commit 23fae26 into beta Aug 2, 2026
9 checks passed
@KevinVandy
KevinVandy deleted the fix/undefined-controlled-state-5909 branch August 2, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableState does not account for options.state properties being set as undefined

1 participant